package main

import "fmt"

func minStartValue(nums []int) int {
	minsum, sum := 0, 0
	for _, num := range nums {
		sum += num
		if sum < minsum {
			minsum = sum
		}
	}
	if minsum > 0 {
		return 1
	} else {
		return 0 - minsum + 1
	}
}

func main() {
	fmt.Println(minStartValue([]int{-3, 2, -3, 4, 2}))
	fmt.Println(minStartValue([]int{1, 2}))
	fmt.Println(minStartValue([]int{1, -2, -3}))
}
